#include "os.h"
#include "log.h"
#include "uart.h"

int __errno = 0;
void _exit(int status){    
}

int _fini(){
    return 0;
}
extern void duktape_task(void*);

void* exit_sem = 0;
void task_wrapper(void* p){
    duktape_task(p);
    platform_release_semaphore(exit_sem);
}
int appimg_enter(void *param)
{    
    log_init();
    debugf("appimg_enter++");
    exit_sem = platform_create_semaphore(0);
    platform_go(task_wrapper,param,1024*8, 0);
    platform_wait_semaphore(exit_sem,-1);
    debugf("appimg_enter--");
    
    return 1;
}

void appimg_exit(void)
{
    
}



void abort(){
    
}